package string;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import java.util.PriorityQueue;

public class QueueTest {
	public static void main(String[] args) {
		PriorityQueue<String> pq = new PriorityQueue<>();//一般添加对象要实现Comparable接口，重写compareTo方法
		pq.add("love");
		pq.add("you");
		pq.add("every");
		pq.add("day");
		while(!pq.isEmpty()) {
			System.out.println(pq.poll());
		}
		
		LinkedHashMap<String, String> lhm = new LinkedHashMap<>();
		lhm.put("1", "love");
		lhm.put("2", "you");
		lhm.put("3", "every");
		lhm.put("4", "day");
		Iterator<Entry<String, String>> iterator = lhm.entrySet().iterator();
		while(iterator.hasNext()) {
			System.out.println(iterator.next());
		}
		
	}

}
